// 配置文件模板
const CONFIG = {
  // Gemini API 配置
  GEMINI_API_KEY: process.env.GEMINI_API_KEY || 'YOUR_GEMINI_API_KEY_HERE', 
  
  // 默认模型设置
  DEFAULT_MODEL: 'gemini-2.5-flash',
  

  
  // 服务器配置
  SERVER_URL: 'http://127.0.0.1:3000',
  
  // 聊天设置
  CHAT: {
    MAX_MESSAGE_LENGTH: 4000,
    TYPING_ANIMATION_DURATION: 1400,
    ERROR_MESSAGE_DURATION: 3000,
    MODEL_CHANGE_NOTIFICATION_DURATION: 3000
  },
  
  // 模型配置
  MODELS: {
    'gemini-2.5-pro': {
      name: 'Gemini 2.5 Pro',
      temperature: 0.8,
      topK: 40,
      topP: 0.95,
      maxOutputTokens: 8192,
    },
    'gemini-2.5-flash': {
      name: 'Gemini 2.5 Flash',
      temperature: 0.7,
      topK: 40,
      topP: 0.95,
      maxOutputTokens: 4096,
    }
  },
  
  // 安全设置
  SAFETY_SETTINGS: [
    {
      category: "HARM_CATEGORY_HARASSMENT",
      threshold: "BLOCK_MEDIUM_AND_ABOVE"
    },
    {
      category: "HARM_CATEGORY_HATE_SPEECH",
      threshold: "BLOCK_MEDIUM_AND_ABOVE"
    },
    {
      category: "HARM_CATEGORY_SEXUALLY_EXPLICIT",
      threshold: "BLOCK_MEDIUM_AND_ABOVE"
    },
    {
      category: "HARM_CATEGORY_DANGEROUS_CONTENT",
      threshold: "BLOCK_MEDIUM_AND_ABOVE"
    }
  ]
};

// 配置验证函数
function validateConfig() {
  if (!CONFIG.GEMINI_API_KEY || CONFIG.GEMINI_API_KEY === 'YOUR_GEMINI_API_KEY_HERE') {
    console.warn('⚠️ 请在 config.js 中设置有效的 Gemini API Key');
    return false;
  }
  return true;
}

// 获取API Key的函数
function getApiKey() {
  return CONFIG.GEMINI_API_KEY;
}

// 获取模型配置的函数
function getModelConfig(modelName) {
  return CONFIG.MODELS[modelName] || CONFIG.MODELS[CONFIG.DEFAULT_MODEL];
}

// 获取所有可用模型
function getAvailableModels() {
  return Object.keys(CONFIG.MODELS);
}

// 获取模型显示名称
function getModelDisplayName(modelName) {
  const model = CONFIG.MODELS[modelName];
  return model ? model.name : modelName;
}

// 导出配置
if (typeof module !== 'undefined' && module.exports) {
  module.exports = {
    CONFIG,
    validateConfig,
    getApiKey,
    getModelConfig,
    getAvailableModels,
    getModelDisplayName
  };
} 